32C - Flea - CodeForces Solution


math *1700

Please click on ads to support us..

Python Code:

n, m, s = map(int, input().split())
print((0--n // s) * ((n - 1) % s + 1) * (0--m // s) * ((m - 1) % s + 1))

C++ Code:

#include <iostream> 
#include <string>
#include <cstdlib>
#include <math.h>
#include <algorithm>
#include <iomanip>
using namespace std;

int main() {
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	long long n, m, c;
	cin >> n >> m >> c;

    cout << ((n-1)/c+1) * ((n-1)%c+1) * ((m-1)/c+1) * ((m-1)%c+1);
	
}


Comments

Submit
0 Comments
More Questions

Count of integers
Differences of the permutations
Doctor's Secret
Back to School
I am Easy
Teddy and Tweety
Partitioning binary strings
Special sets
Smallest chosen word
Going to office
Color the boxes
Missing numbers
Maximum sum
13 Reasons Why
Friend's Relationship
Health of a person
Divisibility
A. Movement
Numbers in a matrix
Sequences
Split houses
Divisible
Three primes
Coprimes
Cost of balloons
One String No Trouble
Help Jarvis!
Lift queries
Goki and his breakup
Ali and Helping innocent people